package com.p2p.front.web.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.p2p.base.model.BaseUser;
import com.p2p.base.page.PageVo;
import com.p2p.base.web.controller.BaseController;
import com.p2p.front.dal.model.MemberPoint;
import com.p2p.front.service.MemberPointService;

/**
 * 2014/12/17
 * @author wyj
 *
 */
@Controller
public class UserScoreController extends BaseController {

	@Resource 
	private MemberPointService memberPointService;
	@RequestMapping("/account/score")
	public String showScore(PageVo form,Model model) {
		BaseUser user = getCurrentUser();
		form.getParams().put("user_id", user.getId());
		PageVo page = memberPointService.listPage(form);
		model.addAttribute("page", page);
		//得到总积分，消耗积分
		MemberPoint memberPoint = memberPointService.getUserMemberPoint(user.getId());
		model.addAttribute("memberPoint", memberPoint);
		return "/account/score";
	}
}
